package cn.schoolwow.util.test.module.query.instanceList.flow.query;

import cn.schoolwow.quickflow.domain.FlowContext;
import cn.schoolwow.quickflow.flow.BusinessFlow;
import cn.schoolwow.util.domain.query.instanceList.QueryInstanceList;
import org.junit.Assert;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

public class InstanceSingleValueQueryFlow implements BusinessFlow {
    @Override
    public void executeBusinessFlow(FlowContext flowContext) throws Exception {
        List<Integer> statusList = new ArrayList<Integer>(Arrays.asList(1,1,2,3,4));

        {
            long count = QueryInstanceList.newQuery(statusList)
                    .addSingleValueQuery(1)
                    .execute()
                    .count();
            Assert.assertEquals(2, count);
        }
        {
            long count = QueryInstanceList.newQuery(statusList)
                    .addSingleValueListQuery(Arrays.asList(2,3,4))
                    .execute()
                    .count();
            Assert.assertEquals(3, count);
        }
    }

    @Override
    public String name() {
        return "实例查询条件测试用例";
    }
}
